<?php
/**
 * @Author: rocky
 * @Copyright: 广州拓冠科技 <http://my8m.com>
 * Date: 2019/7/22
 * Time: 11:11
 */


namespace app\shop\resource;

use app\common\resource\BaseResource;

class MemberResource extends BaseResource
{
    public function toArray($data)
    {
        if($data['member'][0]['status'] == 1){
            $expire_time = date('Y-m-d',$data['member'][0]['expire_time']);
        }else{
            $expire_time = '';
        }
        return [
            'id' => $data['id'],
            'type' => $data['type'],
            'name' => $data['name'],
            'money' => $data['money'],
            'wash_number' => $data['wash_number'],
            'describe' => $data['describe'],
            'content' => $data['content'],
            'total_num' => $data['member'][0]['total_num']?$data['member'][0]['total_num']:0,
            'use_num' => $data['member'][0]['use_num']?$data['member'][0]['use_num']:0,
            'expire_time' => $expire_time,
            'img' => $data['img']
        ];
    }
}